﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using TowerDefence.Entities.States;
using TowerDefence.Entities.Actions;
using TowerDefence.Tiles;

namespace TowerDefence.Entities.Factories
{
    public class MonsterFactory
    {
        ITileLocator tileLocator;

        public MonsterFactory(ITileLocator _tileLocator)
        {
            this.tileLocator = _tileLocator;
        }

        /// <summary>
        /// Creates a generic monster for testing/debugging
        /// Has no visual representation (until there is a way to
        /// mock Texture/SpriteBatch or they are wrapped)
        /// </summary>
        /// <returns>A monster entity</returns>
        public Entity CreateTestMonster(Vector2 _position, float _size, int _health, eAIPath _aiPath)
        {
            var formStates = new StateContainer();
            formStates.AddState(new AliveState());
            formStates.AddState(new HealthState { Health = _health });
            formStates.AddState(new CollisionCircle { Radius = _size, Position = _position });            
            formStates.AddState(new AIPath { Path = _aiPath });
            formStates.AddState(new MovementVector { Vector = Vector2.Zero });
            formStates.AddState(new Speed { Amount = 1f });
            var form = 
                new TestForm { 
                    Position = _position, 
                    Orientation = Vector2.UnitX, 
                    States = formStates };
            
            // TODO: add an IdentityState, which provides a string we can look at in the debugger            
            return new Entity { Form = form };
        }
    }
}
